package com.thiswhyme.fsplus.sentinel.feign.defaultfallback;

import feign.Feign;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Scope;

/**
 * @description: 自定义SentinelFeign注入
 * @author: thiswhyme
 * @date: 2020/10/30
 */
@Configuration
public class SentinelFeignConfig {

    @Bean({"thwmFeignSentinelBuilder"})
    @Scope("prototype")
    @ConditionalOnProperty(name = "feign.sentinel.fsplus.default-fallback-enabled", havingValue = "true")
    @Primary
    public Feign.Builder feignSentinelBuilder() {
        return ThwmSentinelFeign.builder();
    }
}
